﻿using ModernShopping.AppCode;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ModernShopping.Account
{
    public partial class AccountUtil : System.Web.UI.Page
    {
        private const string CHECK_EMAIL = "8c95f2297a6da214e49174bee8437a15";
        private const string CHECK_ACCOUNT = "f7711d30cdda50208e57f9abe942c3a2";

        protected void Page_Load(object sender, EventArgs e)
        {
            bool result = false;
            if (Request.QueryString["Code"] != null)
            {
                string Code = Request.QueryString["Code"];
                if (Code.Equals(CHECK_ACCOUNT))
                {
                    string Username = Request.QueryString["Username"];
                    if (DbCompany.getCompany(Username: Username) != null)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else if (Code.Equals(CHECK_EMAIL))
                {
                    string Email = Request.QueryString["Email"];
                    if (DbCompany.getCompany(Email: Email) != null)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
            }

            if (result)
            {
                Response.Write("True");
            }
            else
            {
                Response.Write("False");
            }
        }
    }
}